export default {
  template: `
    <div>
      <h3>goods</h3>
      <el-table :data="dataSource" border stripe>
        <el-table-column v-for="col in columns"
          :prop="col.id"
          :key="col.id"
          :label="col.label"
          :width="col.width">
        </el-table-column>
        <el-table-column
          label="操作"
          width="200"
        >
        <template slot-scope="scope">
          <el-button v-permission="{action:'add'}" @click="handleClick(scope.row)" type="primary" size="small">查看</el-button>
          <el-button v-permission="{action:'add'}" type="primary" size="small">编辑</el-button>
        </template>
      </el-table-column>
      </el-table>
    </div>
  `,
  data() {
    return {
      dataSource: Mock.mock([
        { id: "@id", name: "@cname", title: "@ctitle", paragraph: "@cparagraph", date: "@date" },
        { id: "@id", name: "@cname", title: "@ctitle", paragraph: "@cparagraph", date: "@date" },
        { id: "@id", name: "@cname", title: "@ctitle", paragraph: "@cparagraph", date: "@date" },
      ]),
      columns: [
        {
          width: "200px", id: "id", label: "id"
        },
        {
          width: '150px', id: "name", label: "名称"
        },
        {
          width: '160px', id: "title", label: "标题"
        },
        {
          width: '330px', id: "paragraph", label: "段落"
        },
        {
          width: '150px', id: "date", label: "日期"
        }
      ]
    }
  },
}